#include "myScreen.h"

MyScreen::MyScreen()
{
}

MyScreen::~MyScreen()
{
}

void MyScreen::Render()
{
	this->pEngine->GetGraphics()->DrawTexture(this->pMyBackground, 0, 0, (float)this->ScreenWidth(), (float)this->ScreenHeight());

	// Normal
	this->pEngine->GetGraphics()->DrawSprite(this->pMySprite0);
	this->pEngine->GetGraphics()->SetModelViewMatrix(Matrix::Identity());

	// Light blend
	this->pEngine->GetGraphics()->DrawSprite(this->pMySprite1);
	this->pEngine->GetGraphics()->SetModelViewMatrix(Matrix::Identity());

	// Dark blend
	this->pEngine->GetGraphics()->DrawSprite(this->pMySprite2);
	this->pEngine->GetGraphics()->SetModelViewMatrix(Matrix::Identity());
}

void MyScreen::Update(float fDelta)
{
	this->pMySprite0->Update(fDelta);
	this->pMySprite1->Update(fDelta);
	this->pMySprite2->Update(fDelta);
}

void MyScreen::Load()
{
	this->pMyTexture = this->pEngine->GetGraphics()->LoadTexture("media/animation.jpg");
	this->pMyBackground = this->pEngine->GetGraphics()->LoadTexture("media/bkgd11.png");

	this->pMySprite0 = new Sprite(this->pMyTexture, 96, 96);	
	this->pMySprite0->SetHandlePosition(0.5f, 0.5f);	
	this->pMySprite0->SetPosition(this->ScreenWidth() / 2.0f, this->ScreenHeight() / 2.0f);

	this->pMySprite1 = new Sprite(this->pMyTexture, 96, 96);
	this->pMySprite1->SetHandlePosition(0.5f, 0.5f);			
	this->pMySprite1->SetPosition((this->ScreenWidth() / 2.0f) + (this->pMySprite1->GetWidth() + 50.0f), this->ScreenHeight() / 2.0f);
	this->pMySprite1->SetBlendMode(DelGEGraphicsBlendMode_Dark);

	this->pMySprite2 = new Sprite(this->pMyTexture, 96, 96);	
	this->pMySprite2->SetHandlePosition(0.5f, 0.5f);			
	this->pMySprite2->SetPosition((this->ScreenWidth() / 2.0f) - (this->pMySprite2->GetWidth() + 50.0f), this->ScreenHeight() / 2.0f);
	this->pMySprite2->SetBlendMode(DelGEGraphicsBlendMode_Light);
}

void MyScreen::Unload()
{
	this->pEngine->GetGraphics()->UnloadTexture(this->pMyTexture);
	this->pEngine->GetGraphics()->UnloadTexture(this->pMyBackground);

	delete this->pMySprite0;
	delete this->pMySprite1;
	delete this->pMySprite2;
}